<?php
/**
 * PlatformConst.php class file.
 * @author shengxia <544038230@qq.com>
 * @date 2021/2/20- 2:30 下午
 */
namespace common\constants;


class PlatformConstGY
{

    /**
     * 淘宝平台
     */
    const PLATFORM_TB = 1;


    /**
     * 天猫
     */
    const PLATFORM_TMALL = 1;

    /**
     * 1688 平台
     */
    const PLATFORM_1688 = 6;





    /**
     * 平台图标
     * @param int $platform
     * @return string
     */
    public static function transPlatIcon(int $platform)
    {
        $platformIcon = '';
        switch ($platform)
        {
            case self::PLATFORM_1688:
                $platformIcon = '1688-icon';
                break;
            case self::PLATFORM_TMALL:
                $platformIcon = 'tmall-icon';
                break;
            case self::PLATFORM_DY:
                $platformIcon = '';
                break;
            case self::PLATFORM_TB:
                $platformIcon = 'taobao-icon';
                break;
            case self::PLATFORM_PDD:
                $platformIcon = 'pdd-icon';
                break;
            case self::PLATFORM_JD:
                $platformIcon = 'jd-icon';
                break;
            case self::PLATFORM_HZ:
                $platformIcon = 'hznz-icon';
                break;
            case self::PLATFORM_JX:
                $platformIcon = 'jx-icon';
                break;
            case self::PLATFORM_17:
                $platformIcon = '17w-icon';
                break;
            case self::PLATFORM_SJXZ:
                $platformIcon = 'sjxz-icon';
                break;
            case self::PLATFORM_QCW:
                $platformIcon = 'qinchuang-icon';
                break;
            case self::PLATFORM_SN:
                $platformIcon = 'suning-icon';
                break;
            case self::PLATFORM_SK:
                $platformIcon = 'soukuan-icon';
                break;
            case self::PLATFORM_SX:
                $platformIcon = 'souxie-icon';
                break;
            case self::PLATFORM_SY:
                $platformIcon = 'shenyi-icon';
                break;
            case self::PLATFORM_WSY:
                $platformIcon = 'wangsy-icon';
                break;
            case self::PLATFORM_DD:
                $platformIcon = 'dd-icon';
                break;
        }
        return $platformIcon;
    }


    /**
     * 返回平台首字母
     * @param int $platform
     * @return string
     */
    public static function transPlatformPy(int $platform)
    {
        $platformPy = '';
        switch ($platform)
        {
            case self::PLATFORM_1688:
                $platformPy = '1688';
                break;
            case self::PLATFORM_TMALL:
                $platformPy = 'TM';
                break;
            case self::PLATFORM_DY:
                $platformPy = 'DY';
                break;
            case self::PLATFORM_TB:
                $platformPy = 'TB';
                break;
            case self::PLATFORM_PDD:
                $platformPy = 'P';
                break;
            case self::PLATFORM_JD:
                $platformPy = 'JD';
                break;
            case self::PLATFORM_HZ:
                $platformPy = 'HZ';
                break;
            case self::PLATFORM_JX:
                $platformPy = 'JX';
                break;
            case self::PLATFORM_17:
                $platformPy = '17';
                break;
            case self::PLATFORM_SJXZ:
                $platformPy = 'SJ';
                break;
            case self::PLATFORM_QCW:
                $platformPy = 'QC';
                break;
            case self::PLATFORM_SN:
                $platformPy = 'SN';
                break;
            case self::PLATFORM_SK:
                $platformPy = 'SK';
                break;
            case self::PLATFORM_SX:
                $platformPy = 'SX';
                break;
            case self::PLATFORM_SY:
                $platformPy = 'SY';
                break;
            case self::PLATFORM_WSY:
                $platformPy = 'WS';
                break;
            case self::PLATFORM_DD:
                $platformPy = 'DD';
                break;
        }
        return $platformPy;
    }

    /**
     * 映射接口平台id
     * @param int $platform
     * @return mixed
     */
    public static function mappingApi(int $platform)
    {
        $mappingArr = [
            3 => 1,
        ];
        return $mappingArr[$platform] ?? $platform;
    }


    /**
     * 翻译平台中文名称
     * @param int $platform
     * @return string
     */
    public static function transPlatform(int $platform)
    {
        $platformName = '';
        switch ($platform)
        {
            case self::PLATFORM_1688:
                $platformName = '1688';
                break;
            case self::PLATFORM_TMALL:
                $platformName = '天猫';
                break;
            case self::PLATFORM_DY:
                $platformName = '抖音';
                break;
            case self::PLATFORM_TB:
                $platformName = '淘宝';
                 break;
            case self::PLATFORM_PDD:
                $platformName = '拼多多';
                break;
            case self::PLATFORM_JD:
                $platformName = '京东';
                break;
            case self::PLATFORM_HZ:
                $platformName = '杭州女装';
                break;
            case self::PLATFORM_JX:
                $platformName = '京喜';
                break;
            case self::PLATFORM_17:
                $platformName = '17网';
                break;
            case self::PLATFORM_SJXZ:
                $platformName = '四季星座';
                break;
            case self::PLATFORM_QCW:
                $platformName = '青创';
                break;
            case self::PLATFORM_SN:
                $platformName = '苏宁';
                break;
            case self::PLATFORM_SK:
                $platformName = '搜款网';
                break;
            case self::PLATFORM_SX:
                $platformName = '搜鞋网';
                break;
            case self::PLATFORM_SY:
                $platformName = '生意网';
                break;
            case self::PLATFORM_WSY:
                $platformName = '网商园';
                break;
            case self::PLATFORM_DD:
                $platformName = '当当网';
                break;
        }
        return $platformName;
    }
}